#ifndef DT_H
#define DT_H
#include <stdint.h>

#define DT_GRAN		(1<<7)
#define DT_BIG		(1<<6)
#define DT_Z		(1<<5)
#define DT_AVAIL	(1<<4)
#define DT_PRESENT	(1<<15)
#define DT_DPL0		0
#define DT_DPL1		(1<<13)
#define DT_DPL2		(2<<13)
#define DT_DPL3		(3<<13)
#define DT_CODE		((1<<12)|(1<<11))
#define DT_DATA		(1<<12)
#define DT_CONFORM	(1<<10)
#define DT_STACKDOWN	(1<<10)
#define DT_RW		(1<<9)
#define DT_ACCESSED	(1<<8)

typedef struct __attribute__ ((__packed__)){
	uint16_t limit0;
	uint16_t base0;
	uint8_t base1;
	uint8_t attr0;
	uint8_t attr1_limit1;
	uint8_t base2;
}volatile tdtr;

tdtr* dt_clear(unsigned int address, unsigned int count);

void dt_nongate(tdtr *dr, unsigned int index, 
		unsigned int base, unsigned int limit,
		unsigned int attr);
void dt_on(tdtr*);
#endif

